package main
import "fmt"
//类型选择
func do (i interface{}){
	switch v := i.(type) {
	case int:
		fmt.Printf("Twice %v is %v\n",v,v*2)
	case string:
		//%q：格式化占位符，将参数转换为带双引号的字符串，适用于string、int、true类型
		fmt.Printf("%q is %v bytes long\n",v,len(v))
	default:
		fmt.Printf("I don't know about type %T!\n",v)
	}
}
func main() {
	do(21)//Twice 21 is 42
	do("hello")//"hello" is 5 bytes long
	do(true)//I don't know about type bool!
}